<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录 - 小红书数据管理系统</title>
    <!-- 引入字体 -->
    <link href="https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;600;700&display=swap" rel="stylesheet">
    <!-- 引入Bootstrap 5 -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- 引入Font Awesome -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css">
    <!-- 引入Animate.css -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css">
    <style>
        :root {
            --primary-color: #FF4F5E;
            --primary-dark: #E93E4D;
            --secondary-color: #6A7BFF;
            --dark-color: #343a40;
            --light-color: #f8f9fa;
            --success-color: #2DCE89;
            --info-color: #11CDEF;
            --warning-color: #FB6340;
            --danger-color: #F5365C;
        }

        body {
            font-family: 'Nunito', sans-serif;
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
            background-image: url("{{ url_for('static', filename='八方来财.jpg') }}");
            background-size: cover;
            background-position: center center;
            background-repeat: no-repeat;
            background-attachment: fixed;
        }

        .login-container {
            width: 100%;
            max-width: 400px;
        }

        .login-card {
            background-color: rgba(255, 255, 255, 0.4);
            border-radius: 10px;
            overflow: hidden;
            backdrop-filter: blur(5px);
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.3);
        }

        .login-header {
            background-color: var(--primary-color);
            padding: 30px 20px;
            text-align: center;
            color: white;
        }

        .login-header .logo {
            font-size: 3rem;
            margin-bottom: 10px;
        }

        .login-header h1 {
            font-weight: 700;
            font-size: 1.8rem;
            margin-bottom: 0;
        }

        .login-header p {
            opacity: 0.9;
            margin-bottom: 0;
        }

        .login-body {
            padding: 30px;
            background-color: rgba(255, 255, 255, 0.2);
        }

        .form-control {
            padding: 12px 15px;
            border-radius: 8px;
            font-size: 1rem;
            border: 1px solid rgba(255, 255, 255, 0.5);
            background-color: rgba(255, 255, 255, 0.3);
            color: #333;
            transition: all 0.3s;
        }

        .form-control:focus {
            border-color: var(--primary-color);
            box-shadow: 0 0 0 0.25rem rgba(255, 79, 94, 0.25);
            background-color: rgba(255, 255, 255, 0.5);
        }

        .form-control::placeholder {
            color: rgba(0, 0, 0, 0.5);
        }

        .form-label {
            color: #333;
            text-shadow: 0 1px 2px rgba(255, 255, 255, 0.7);
            font-weight: 600;
        }

        .input-group-text {
            background-color: rgba(255, 255, 255, 0.3);
            border: 1px solid rgba(255, 255, 255, 0.5);
            border-radius: 8px 0 0 8px;
            border-right: none;
            color: #333;
        }

        .login-btn {
            background-color: var(--primary-color);
            border-color: var(--primary-color);
            padding: 12px 15px;
            font-weight: 600;
            border-radius: 8px;
            transition: all 0.3s;
            width: 100%;
        }

        .login-btn:hover, .login-btn:focus {
            background-color: var(--primary-dark);
            border-color: var(--primary-dark);
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(233, 62, 77, 0.2);
        }

        .login-footer {
            text-align: center;
            padding-top: 20px;
            color: #fff;
            font-size: 0.9rem;
            text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
        }

        .alert {
            border-radius: 8px;
            font-weight: 600;
        }
        
        .form-remember {
            display: flex;
            justify-content: space-between;
            margin-bottom: 1rem;
            color: #333;
            text-shadow: 0 1px 2px rgba(255, 255, 255, 0.7);
        }
        
        .form-check-input:checked {
            background-color: var(--primary-color);
            border-color: var(--primary-color);
        }
        
        .forgot-password {
            color: #333;
            text-decoration: none;
            font-size: 0.9rem;
            font-weight: 600;
            text-shadow: 0 1px 2px rgba(255, 255, 255, 0.7);
        }
        
        .forgot-password:hover {
            color: var(--primary-color);
            text-decoration: underline;
        }
        
        /* 动画效果 */
        .animate-login {
            animation: fadeInUp 0.5s;
        }
        
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
    </style>
</head>
<body>
    <div class="login-container animate-login">
        {% with messages = get_flashed_messages(with_categories=true) %}
            {% if messages %}
                {% for category, message in messages %}
                    <div class="alert alert-{{ category }} mb-4 animate__animated animate__fadeIn" role="alert">
                        {{ message }}
                    </div>
                {% endfor %}
            {% endif %}
        {% endwith %}
        
        <div class="login-card">
            <div class="login-header">
                <div class="logo">
                    <i class="fas fa-chart-line"></i>
                </div>
                <h1>汇友数据管理系统</h1>
                <p>请登录您的账户</p>
            </div>
            
            <div class="login-body">
                <form action="{{ url_for('xhs.login') }}" method="post">
                    <div class="mb-4">
                        <label for="username" class="form-label fw-bold">用户名</label>
                        <div class="input-group">
                            <span class="input-group-text"><i class="fas fa-user"></i></span>
                            <input type="text" class="form-control" id="username" name="username" placeholder="请输入用户名" required>
                        </div>
                    </div>
                    
                    <div class="mb-4">
                        <label for="password" class="form-label fw-bold">密码</label>
                        <div class="input-group">
                            <span class="input-group-text"><i class="fas fa-lock"></i></span>
                            <input type="password" class="form-control" id="password" name="password" placeholder="请输入密码" required>
                        </div>
                    </div>
                    
                    <div class="form-remember">
                        <div class="form-check">
                            <input class="form-check-input" type="checkbox" id="remember" name="remember">
                            <label class="form-check-label" for="remember">
                                记住我
                            </label>
                        </div>
                        <a href="#" class="forgot-password">忘记密码?</a>
                    </div>
                    
                    <button type="submit" class="btn btn-primary login-btn">
                        <i class="fas fa-sign-in-alt me-2"></i>登录
                    </button>
                </form>
            </div>
        </div>
        
        <div class="login-footer mt-4">
            <p>© 2025 汇友管理系统保留所有权利.</p>
        </div>
    </div>

    <!-- 引入Bootstrap JS -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        // 登录表单提交验证
        document.addEventListener('DOMContentLoaded', function() {
            const form = document.querySelector('form');
            
            form.addEventListener('submit', function(event) {
                const username = document.getElementById('username').value.trim();
                const password = document.getElementById('password').value.trim();
                
                if (!username || !password) {
                    event.preventDefault();
                    const alert = document.createElement('div');
                    alert.className = 'alert alert-danger animate__animated animate__fadeIn';
                    alert.role = 'alert';
                    alert.textContent = '请输入用户名和密码';
                    
                    const container = document.querySelector('.login-container');
                    container.insertBefore(alert, container.firstChild);
                    
                    // 3秒后自动移除提示
                    setTimeout(() => {
                        alert.remove();
                    }, 3000);
                }
            });
        });
    </script>
</body>
</html> 